
//
//  ClassDetailTBCellOfTop.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/23.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "ClassDetailTBCellOfTop.h"

@implementation ClassDetailTBCellOfTop

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubView];
        [self layout];
    }
    return self;
}

- (void)initSubView{
    [self addSubview:self.contentLabel];
    [self addSubview:self.nameLabel];
    [self addSubview:self.lineView];
}
- (void)layout{
    [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX).offset(10);
        make.centerY.equalTo(self.mas_centerY);
        make.width.equalTo(@250);
        make.height.equalTo(@15);
    }];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self->_contentLabel.mas_left).offset(-10);
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(@20);
        make.height.equalTo(@15);
    }];
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.mas_bottom);
        make.height.equalTo(@1);
        make.width.equalTo(self->_contentLabel.mas_width);
        make.centerX.equalTo(self->_contentLabel.mas_centerX);
    }];
}
- (UIView *)lineView{
    if (!_lineView) {
        UIView *view = [[UIView alloc]init];
        view.backgroundColor = LINCOLOR;
        _lineView = view;
    }
    return _lineView;
}
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text = @"标题:";
        label.textColor = TITLECOLOR;
        label.textAlignment = 2;
        label.font = [UIFont systemFontOfSize:14];
        _nameLabel = label;
    }
    return _nameLabel;
}
- (UILabel *)contentLabel{
    if (!_contentLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text = @"标题";
        label.textColor = TITLECOLOR;
        label.textAlignment = 0;
        label.font = [UIFont systemFontOfSize:14];
        _contentLabel = label;
    }
    return _contentLabel;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
